home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / conf.files / doinst.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1996-08-04  |  8KB  |  257 lines

  1. #!/bin/sh
  2. # Installation script for linuxconf
  3. BIN=/bin
  4. USRBIN=/usr/bin
  5. SBIN=/sbin
  6. rcm=/etc/rc.d/rc.M
  7. checkalready(){
  8.     if [ `grep askrunlevel $rcs | wc -l` = 1 ] ; then
  9.         echo
  10.         echo Linuxconf has already been installed on this
  11.         echo machine once, no need to update RC scripts
  12.         echo
  13.         exit 0
  14.     fi
  15. }
  16. if [ -f /etc/rc.d/rc.sysinit ] ; then
  17.     echo
  18.     echo redhat based system detected
  19.     echo This installation script has been tested on
  20.     echo "     " RedHat 3.0.3
  21.     #echo "     " Caldera 1.0
  22.     echo
  23.     rcs=/etc/rc.d/rc.sysinit
  24.     checkalready
  25. elif [ -f /etc/rc.d/rc.S -a -f /etc/rc.d/rc.inet1 -a -f /etc/rc.d/rc.inet2 ]; then
  26.     echo
  27.     echo Slackware based system detected
  28.     echo
  29.     rcs=/etc/rc.d/rc.S
  30.     checkalready
  31. else
  32.     echo
  33.     echo '           ********************'
  34.     echo '           ********************'
  35.     echo '           **** attention *****'
  36.     echo '           ********************'
  37.     echo '           ********************'
  38.     echo
  39.     echo This linux system does not look like a Slackware system
  40.     echo nor a RedHat based system
  41.     echo
  42.     echo Please inspect the /install/doinst.sh script
  43.     echo before going further
  44.     echo linuxconf should be compatible with most Linux
  45.     echo system out there, but a very simple incompatibilty
  46.     echo may render your system unbootable.
  47.     echo
  48.     echo -n Do you want to continue anyway '? '
  49.     read yes
  50.     if [ "$yes" != "y" ]; then
  51.         exit
  52.     fi
  53. fi
  54.  
  55. replace_if(){
  56.     echo -n Do you want to replace $BIN/$1 \($2\) '? '
  57.     read yes
  58.     if [ "$yes" = "y" ] ; then
  59.         if [ -f $BIN/$1 ] ; then
  60.             if [ ! -f $BIN/$1.old ] ; then
  61.                 echo Making a backup copy $BIN/$1 '->' $BIN/$1.old
  62.                 mv $BIN/$1 $BIN/$1.old
  63.             fi
  64.             ln -sf $BIN/linuxconf $BIN/$1
  65.         elif [ -f $USRBIN/$1 ] ; then
  66.             if [ ! -f $USRBIN/$1.old ] ; then
  67.                 echo Making a backup copy $USTBIN/$1 '->' $USRBIN/$1.old
  68.                 mv $USRBIN/$1 $USRBIN/$1.old
  69.             fi
  70.             ln -sf $BIN/linuxconf $USRBIN/$1
  71.         else
  72.             echo No $BIN/$1 nor $USRBIN/$1 on this system
  73.         fi
  74.     fi
  75. }
  76.  
  77.  
  78. rm -f /sbin/linuxconf
  79. ln -sf $BIN/linuxconf $BIN/netconf
  80. ln -sf $BIN/linuxconf $BIN/xconf
  81. ln -sf $BIN/linuxconf $BIN/lpdconf
  82. ln -sf $BIN/linuxconf $BIN/fsconf
  83. ln -sf $BIN/linuxconf $SBIN/askrunlevel
  84. ln -sf $BIN/linuxconf $SBIN/dnsconf
  85. ln -sf $BIN/linuxconf $SBIN/fixperm
  86. ln -sf $BIN/linuxconf $SBIN/mailconf
  87. ln -sf $BIN/linuxconf $BIN/userconf
  88.  
  89. sleep 2
  90. echo
  91. echo '================================================='
  92. echo
  93.  
  94. if [ -f /etc/rc.d/rc.sysinit ] ; then
  95.     echo The /etc/inittab file provided on RedHat system is
  96.     echo incompatible with linuxconf. One replacement inittab
  97.     echo is provided here. I can install it here after doing
  98.     echo a backup \(/etc/inittab.old\).
  99.     echo Not installing it will prevent Linuxconf from operating
  100.     echo normally. Operation without the modified inittab is
  101.     echo possible, but not support by this script. Email
  102.     echo me \(jacques@solucorp.qc.ca\) so we can talk about it.
  103.     echo
  104.     echo -n Do you want to install the special /etc/inittab '? '
  105.     read yes
  106.     if [ "$yes" = "y" ] ; then
  107.         if [ ! -f /etc/inittab.old ] ; then
  108.             echo Making a backup copy /etc/inittab.old
  109.             mv /etc/inittab /etc/inittab.old
  110.         fi
  111.         mv /install/inittab.redhat /etc/inittab
  112.     else
  113.         echo aborting linuxconf installation
  114.         echo You can still use linuxconf to manage some
  115.         echo key parts of your system, but it won\'t control
  116.         echo its operation.
  117.         exit 1
  118.     fi
  119. fi
  120. sleep 2
  121. echo
  122. echo '================================================='
  123. echo
  124.  
  125. echo One of the great feature of linuxconf is the askrunlevel
  126. echo utility. This utility start pretty early during the boot
  127. echo process and present you with a nice set of options
  128. echo From there you can decide the operation mode and you
  129. echo can even configure right away your system.
  130. echo askrunlevel avoid those false start boot with an invalid
  131. echo configuration.
  132. echo
  133. echo To activate this feature you need to place a call /sbin/askrunlevel
  134. echo at the end of the $rcs script. I can install this for you.
  135. echo
  136. echo -n Do you want to modify $rcs '? '
  137. read yes
  138. if [ "$yes" = "y" ] ; then
  139.     if [ `grep askrunlevel $rcs | wc -l` = 0 ] ; then
  140.         echo /sbin/askrunlevel >>$rcs
  141.         echo
  142.         echo $rcs has been modified
  143.     else
  144.         echo $rcs already looks ok
  145.     fi
  146.     echo
  147.     echo You may want to remove the clock command from
  148.     echo the file $rcs. askrunlevel take care of
  149.     echo setting the system time from the CMOS. Linuxconf
  150.     echo provide a nice form to set the system time.
  151.     echo Check the help about it.
  152.     echo
  153.     echo -n 'hit <enter> to continue '
  154.     read yes
  155. fi
  156.  
  157. sleep 2
  158. echo
  159. echo '================================================='
  160. echo
  161.  
  162. echo linuxconf is both a configurator and an activator
  163. echo It means that it replace most of the startup scripts
  164. echo with a single simple rc.M script
  165. echo
  166. echo -n Do you want to install the simpler rc.M script '? '
  167. read yes
  168. if [ "$yes" = "y" ] ; then
  169.     if [ ! -f $rcm.old ] ; then
  170.         echo Making a backup copy $rcm.old
  171.         mv $rcm $rcm.old
  172.     fi
  173.     mv /install/rc.M $rcm
  174. fi
  175. sleep 2
  176. echo
  177. echo '================================================='
  178. echo
  179. echo linuxconf may be run with the setuid root flag.
  180. echo It allows anyone to use and configure the system without
  181. echo being root \"first\". At the proper time, the user will
  182. echo be prompt for the root password. If the user does not know
  183. echo it, it will be denied the operation he is attempting.
  184. echo This feature is extremly convenient.
  185. echo
  186. echo -n Do you want to activate the setuid mode of linuxconf '? '
  187. read yes
  188. if [ "$yes" = "y" ] ; then
  189.     chown root.root $BIN/linuxconf
  190.     chmod 4755 $BIN/linuxconf
  191.  
  192.     sleep 2
  193.     echo
  194.     echo '================================================='
  195.     echo
  196.     echo linuxconf is a replacement for few utilities
  197.     echo This script will make a backup copy of the utilities
  198.     echo and will setup a symbolic link to $BIN/linuxconf
  199.     echo
  200.     echo You will be prompt separatly for each utilty.
  201.     echo Answer y for yes or anything else for no
  202.     echo
  203.     replace_if passwd "recommended"
  204.     #replace_if hostname "Save disk space a bit"
  205.     #replace_if domainname "Save disk space a bit"
  206. else
  207.     chown root.root $BIN/linuxconf
  208.     chmod 755 $BIN/linuxconf
  209. fi
  210.  
  211. if [ `grep linuxconf /etc/inetd.conf | wc -l` = 0 ] ; then
  212.     sleep 2
  213.     echo
  214.     echo '================================================='
  215.     echo
  216.     echo One very special feature of Linuxconf is that it may
  217.     echo be operated using a Web browser. This is especially
  218.     echo convenient to do remote administration. You don\'t need
  219.     echo to have a web server on this machine to get this feature:
  220.     echo Linuxconf is in itself a simple web server started on
  221.     echo demand by the inetd superserver.
  222.     echo
  223.     echo -n Do you want to install this capability \?
  224.     read yes
  225.     if [ "$yes" = "y" ] ; then
  226.         echo linuxconf 98/tcp >>/etc/services
  227.         echo linuxconf stream tcp wait root /bin/linuxconf linuxconf --http >>/etc/inetd.conf
  228.         killall -HUP inetd
  229.         echo
  230.         echo Linuxconf\'s web mode is now installed and operationnal
  231.         echo To use it, just point your favorite web browser to
  232.         echo http:/this_machine:98/
  233.     fi
  234. fi
  235.  
  236.  
  237. sleep 2
  238. echo
  239. echo '=============== The end ========================='
  240. echo
  241. echo Linuxconf is now installed
  242. echo just type linuxconf to get a full menu of configuration option.
  243. echo While there, check the first help screen to learn more.
  244. echo
  245. echo After that, you should look at the following screens and menus
  246. echo to assure proper operation
  247. echo
  248. echo "    " Basic host configuration
  249. echo "    " Networking/routing and gateways
  250. echo "    " boot mode/default boot mode
  251. echo "    " date \& time
  252. echo
  253. echo These feature uses special configuration files which are unique
  254. echo to Linuxconf. The other feature managed by linuxconf are managed
  255. echo using the standard configuration file \(When they exist\).
  256.  
  257.